
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>php加密机制 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="06_php画图.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../php基础/01_php介绍.html">
            
                <a href="../php基础/01_php介绍.html">
            
                    
                    php基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../php基础/01_php介绍.html">
            
                <a href="../php基础/01_php介绍.html">
            
                    
                    php介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../php基础/02_PHP基础语法.html">
            
                <a href="../php基础/02_PHP基础语法.html">
            
                    
                    php基础语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../php基础/03_php变量.html">
            
                <a href="../php基础/03_php变量.html">
            
                    
                    php变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../php基础/04_php数据类型.html">
            
                <a href="../php基础/04_php数据类型.html">
            
                    
                    php数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../php基础/05_php常量.html">
            
                <a href="../php基础/05_php常量.html">
            
                    
                    php常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../php基础/06_php运算符.html">
            
                <a href="../php基础/06_php运算符.html">
            
                    
                    php运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../php基础/07_php流程控制.html">
            
                <a href="../php基础/07_php流程控制.html">
            
                    
                    php流程控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="../php基础/08_php数组.html">
            
                <a href="../php基础/08_php数组.html">
            
                    
                    php数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="../php基础/09_php函数.html">
            
                <a href="../php基础/09_php函数.html">
            
                    
                    php函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="../php基础/10_php面向对象.html">
            
                <a href="../php基础/10_php面向对象.html">
            
                    
                    php面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="../php基础/11_php命名空间.html">
            
                <a href="../php基础/11_php命名空间.html">
            
                    
                    php命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="../php基础/12_php日期和时间.html">
            
                <a href="../php基础/12_php日期和时间.html">
            
                    
                    php日期时间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="../php基础/13_php表单.html">
            
                <a href="../php基础/13_php表单.html">
            
                    
                    php表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" data-path="../php基础/14_php包含文件.html">
            
                <a href="../php基础/14_php包含文件.html">
            
                    
                    php包含文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="../php基础/15_php常用函数.html">
            
                <a href="../php基础/15_php常用函数.html">
            
                    
                    php常用函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="16_php常用变量函数.md">
            
                <span>
            
                    
                    php常用变量函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="01_php错误与异常.html">
            
                <a href="01_php错误与异常.html">
            
                    
                    php错误与异常
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="02_PhpStorm本地断点调试.html">
            
                <a href="02_PhpStorm本地断点调试.html">
            
                    
                    PhpStorm本地断点调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="03_php文件操作.html">
            
                <a href="03_php文件操作.html">
            
                    
                    php文件操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="04_cookie机制.html">
            
                <a href="04_cookie机制.html">
            
                    
                    cookie机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="05_session.html">
            
                <a href="05_session.html">
            
                    
                    session
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="06_php画图.html">
            
                <a href="06_php画图.html">
            
                    
                    php画图
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.6" data-path="07_php加密机制.html">
            
                <a href="07_php加密机制.html">
            
                    
                    php加密机制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >php加密机制</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x52A0;&#x5BC6;&#x673A;&#x5236;">&#x52A0;&#x5BC6;&#x673A;&#x5236;</h1>
<h3 id="php&#x4E2D;&#x7684;&#x51E0;&#x79CD;&#x52A0;&#x5BC6;&#x65B9;&#x5F0F;">PHP&#x4E2D;&#x7684;&#x51E0;&#x79CD;&#x52A0;&#x5BC6;&#x65B9;&#x5F0F;</h3>
<ul>
<li>md5()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</li>
<li>crypt()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</li>
<li>sha1()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</li>
<li>URL&#x7F16;&#x7801;&#x52A0;&#x5BC6;&#x6280;&#x672F;</li>
<li>Base64&#x7F16;&#x7801;&#x52A0;&#x5BC6;&#x6280;&#x672F;</li>
</ul>
<h3 id="md5&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;">md5()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</h3>
<p>&#x8BA1;&#x7B97;str&#x7684;md5&#x6563;&#x5217;&#x503C;</p>
<pre><code class="lang-php">string md5( string $str [, bool $raw_output = <span class="hljs-keyword">false</span> ])
</code></pre>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">$str</td>
<td style="text-align:left">&#x539F;&#x59CB;&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
<tr>
<td style="text-align:left">$raw_output</td>
<td style="text-align:left">&#x8FD4;&#x56DE;&#x4EE5;32&#x4F4D;&#x5B57;&#x7B26;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x5F62;&#x5F0F;&#x8FD4;&#x56DE;(&#x8BBE;&#x7F6E;&#x4E3A;true&#xFF0C;&#x90A3;&#x4E48;md5&#x6458;&#x8981;&#x5C06;&#x4EE5;16&#x5B57;&#x8282;&#x957F;&#x5EA6;&#x7684;&#x539F;&#x59CB;&#x4E8C;&#x8FDB;&#x5236;&#x683C;&#x5F0F;&#x8FD4;&#x56DE;)</td>
</tr>
</tbody>
</table>
<blockquote>
<p>MD5&#x52A0;&#x5BC6;&#x5DF2;&#x7ECF;&#x4E0D;&#x5B89;&#x5168;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;2&#x6B21;md5&#x7684;&#x7ED3;&#x679C;&#x6765;&#x5F3A;&#x5316;&#x5BC6;&#x7801;&#x5B89;&#x5168;&#x6027;&#x3002;</p>
</blockquote>
<p>MD5&#x7684;&#x52A0;&#x5BC6;&#x65B9;&#x5F0F;&#x76EE;&#x524D;&#x5DF2;&#x7ECF;&#x4E0D;&#x592A;&#x5B89;&#x5168;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x7684;&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;&#x5B9E;&#x5728;&#x662F;&#x663E;&#x5F97;&#x6709;&#x70B9;&#x7B80;&#x5355;&#x4E86;&#xFF0C;&#x800C;&#x4E14;&#x5F88;&#x591A;&#x7834;&#x89E3;&#x5BC6;&#x7801;&#x7684;&#x7AD9;&#x70B9;&#x90FD;&#x5B58;&#x653E;&#x4E86;&#x5F88;&#x591A;&#x7ECF;&#x8FC7;MD5&#x52A0;&#x5BC6;&#x7684;&#x5BC6;&#x7801;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x63D0;&#x5021;&#x8FD8;&#x5728;&#x5355;&#x5355;&#x4F7F;&#x7528;MD5&#x6765;&#x52A0;&#x5BC6;&#x7528;&#x6237;&#x7684;&#x5BC6;&#x7801;&#x7684;&#x3002;</p>
<h3 id="crypt&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;">crypt()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</h3>
<p>&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x57FA;&#x4E8E;&#x6807;&#x51C6;UNIX DES&#x7B97;&#x6CD5;&#x6216;&#x7CFB;&#x7EDF;&#x4E0A;&#x5176;&#x5B83;&#x53EF;&#x7528;&#x7684;&#x66FF;&#x4EE3;&#x7B97;&#x6CD5;&#x7684;&#x6563;&#x5217;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<pre><code>string crypt(string $str [,string $salt])
</code></pre><p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">$str</td>
<td style="text-align:left">&#x539F;&#x59CB;&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
<tr>
<td style="text-align:left">$salt</td>
<td style="text-align:left">&#x52A0;&#x5BC6;&#x65F6;&#x7684;&#x5E72;&#x6270;&#x4E32;,&#x4F7F;&#x5F97;&#x7F16;&#x7801;&#x66F4;&#x5B89;&#x5168;</td>
</tr>
</tbody>
</table>
<h3 id="sha1&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;">sha1()&#x52A0;&#x5BC6;&#x7B97;&#x6CD5;</h3>
<p>&#x8BA1;&#x7B97;&#x5B57;&#x7B26;&#x4E32;&#x7684;sha1&#x6563;&#x5217;&#x503C;</p>
<pre><code>string sha1(string $str [,bool $raw_output=false]);
</code></pre><p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;</th>
<th style="text-align:left">&#x63CF;&#x8FF0;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">$str</td>
<td style="text-align:left">&#x539F;&#x59CB;&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
<tr>
<td style="text-align:left">$raw_output</td>
<td style="text-align:left">&#x8FD4;&#x56DE;&#x4EE5;40&#x4F4D;&#x5B57;&#x7B26;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x5F62;&#x5F0F;&#x8FD4;&#x56DE;(&#x8BBE;&#x7F6E;&#x4E3A;true&#xFF0C;&#x90A3;&#x4E48;sha1&#x6458;&#x8981;&#x5C06;&#x4EE5;20&#x5B57;&#x7B26;&#x957F;&#x5EA6;&#x7684;&#x539F;&#x59CB;&#x4E8C;&#x8FDB;&#x5236;&#x683C;&#x5F0F;&#x8FD4;&#x56DE;)</td>
</tr>
</tbody>
</table>
<h3 id="url&#x7F16;&#x7801;&#x52A0;&#x5BC6;&#x6280;&#x672F;">URL&#x7F16;&#x7801;&#x52A0;&#x5BC6;&#x6280;&#x672F;</h3>
<h4 id="urlencode-&#x7F16;&#x7801;url&#x5B57;&#x7B26;&#x4E32;">urlencode &#x7F16;&#x7801;URL&#x5B57;&#x7B26;&#x4E32;</h4>
<pre><code class="lang-php">string urlencode(string $str)
</code></pre>
<p>$str &#x8981;&#x7F16;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x8FD4;&#x56DE;&#x7F16;&#x7801;&#x540E;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<p>&#x7F16;&#x7801;&#x89C4;&#x8303;&#xFF1A;&#x6B64;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x9664;&#x4E86; <code>-_.</code>&#x4E4B;&#x5916;&#x7684;&#x6240;&#x6709;&#x975E;&#x5B57;&#x6BCD;&#x6570;&#x5B57;&#x5B57;&#x7B26;&#x90FD;&#x5C06;&#x88AB;&#x66FF;&#x6362;&#x6210;&#x767E;&#x5206;&#x53F7;(%)&#x540E;&#x8DDF;&#x4E24;&#x4F4D;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x6570;&#xFF0C;&#x7A7A;&#x683C;&#x5219;&#x7F16;&#x7801;&#x4E3A;&#x52A0;&#x53F7;(+)</p>
<h4 id="urldecode-&#x89E3;&#x7801;&#x5DF2;&#x7F16;&#x7801;&#x7684;url&#x5B57;&#x7B26;&#x4E32;">urldecode &#x89E3;&#x7801;&#x5DF2;&#x7F16;&#x7801;&#x7684;URL&#x5B57;&#x7B26;&#x4E32;</h4>
<pre><code class="lang-php">string urldecode(string $str)
</code></pre>
<p>$str &#x8981;&#x89E3;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x8FD4;&#x56DE;&#x89E3;&#x7801;&#x540E;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<h4 id="rawurlencode-&#x7F16;&#x7801;url&#x5B57;&#x7B26;&#x4E32;">rawurlencode &#x7F16;&#x7801;URL&#x5B57;&#x7B26;&#x4E32;</h4>
<p>&#x6309;&#x7167;RFC1738&#x5BF9;URL&#x8FDB;&#x884C;&#x7F16;&#x7801;</p>
<pre><code class="lang-php">string rawurlencode(string $str)
</code></pre>
<p>$str &#x8981;&#x7F16;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x8FD4;&#x56DE;&#x7F16;&#x7801;&#x540E;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x628A;&#x7A7A;&#x683C;&#x7F16;&#x7801;&#x4E3A;%20</p>
<h4 id="rawurldecode-&#x89E3;&#x7801;&#x5DF2;&#x7F16;&#x7801;&#x7684;url&#x5B57;&#x7B26;&#x4E32;">rawurldecode &#x89E3;&#x7801;&#x5DF2;&#x7F16;&#x7801;&#x7684;URL&#x5B57;&#x7B26;&#x4E32;</h4>
<pre><code class="lang-php">string rawurldecode(string $str)
</code></pre>
<p>$str &#x8981;&#x89E3;&#x7801;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>
<p>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x8FD4;&#x56DE;&#x89E3;&#x7801;&#x540E;&#x7684;&#x5B57;&#x7B26;&#x4E32;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="06_php画图.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: php画图">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"php加密机制","level":"1.3.6","depth":2,"previous":{"title":"php画图","level":"1.3.5","depth":2,"path":"php/php高级/06_php画图.md","ref":"./php/php高级/06_php画图.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"php/php高级/07_php加密机制.md","mtime":"2020-04-23T10:29:44.970Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-23T11:06:38.883Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

